package com.sskj.hhrt.mine;


import android.content.Context;
import android.content.Intent;
import android.webkit.WebView;
import android.widget.LinearLayout;

import com.just.agentweb.AgentWeb;
import com.sskj.base.BuildConfig;
import com.sskj.hhrt.MVPActivity;
import com.sskj.base.view.ToolBarLayout;
import com.sskj.hhrt.R;

import butterknife.BindView;

/**
 * 新手指导
 *
 * @author Hey
 * Create at  2019/03/21
 */
public class GuideActivity extends MVPActivity<GuidePresenter> {

    @BindView(R.id.toolbar)
    ToolBarLayout toolbar;
    @BindView(R.id.webView)
    WebView webView;

    AgentWeb mAgentWeb;

    @Override
    public int getLayoutId() {
        return R.layout.activity_guide;
    }

    @Override
    public GuidePresenter getPresenter() {
        return new GuidePresenter();
    }

    @Override
    public void initView() {
        toolbar.setLeftButtonOnClickListener(v -> finish());
    }

    @Override
    public void initData() {
        mAgentWeb = AgentWeb.with(this)
                .setAgentWebParent(webView, new LinearLayout.LayoutParams(-1, -1))
                .useDefaultIndicator()
                .createAgentWeb()
                .ready()
                .go("");
        mAgentWeb.getWebCreator().getWebView().loadUrl(BuildConfig.BASE_URL + "app/interface?app=app&action=newShow");
    }

    public static void start(Context context) {
        Intent intent = new Intent(context, GuideActivity.class);
        context.startActivity(intent);
    }

}
